load('./dm.Rdata')
df <- dm_base %>% 
  rename(retina = reti, skin = derm, vessel = vesl, nerve = neur,kidney = neph, depression = depress, gender = xingbie ) %>%
  mutate(retina = as.numeric(retina),
         skin = as.numeric(skin),
         vessel = as.numeric(vessel),
         nerve = as.numeric(nerve),
         kidney = as.numeric(kidney)) %>% 
  mutate(complications = retina + skin + vessel + nerve + kidney + depression) %>%
  mutate(complications = as.factor(complications))
levels(df$complications) <- list(none=0,one=1,more_than_two=c(2:6))
plot1<-ggplot(df, aes(x = dmage, y = retina, fill = gender)) + 
                              geom_histogram(stat = "identity", width = .6) + 
                              labs(title="The complication of retina with diabetes age") +
                              theme_tufte() +  
                              theme(plot.title = element_text(hjust = .5), 
                                    axis.ticks = element_blank())
## Warning: Ignoring unknown parameters: binwidth, bins, pad
ggplotly(plot1)
plot2<-ggplot(df, aes(x = dmage, y = skin, color=gender)) + 
                              geom_histogram(stat = "identity", width = .6) + 
                              facet_grid(. ~ gender)
## Warning: Ignoring unknown parameters: binwidth, bins, pad
                              labs(title="The complication of retina with diabetes age") +
                              theme(plot.title = element_text(hjust = .5), 
                                    axis.ticks = element_blank())
## NULL
ggplotly(plot2)